package com.ostrich.note.adapter;


import android.text.TextUtils;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.bumptech.glide.load.resource.bitmap.CenterCrop;
import com.bumptech.glide.load.resource.bitmap.CircleCrop;

import androidx.databinding.BindingAdapter;

public class ImageViewAdapter {
    @BindingAdapter("android:setImage")
    public static void setImage(ImageView imageView,String url){
        if(!TextUtils.isEmpty(url)){
            Glide.with(imageView)
                    .load(url)
                    .transform(new CenterCrop())
                    .into(imageView);
        }

    }
    @BindingAdapter("android:setCircleImage")
    public static void setCircleImage(ImageView imageView,String url){
        if(!TextUtils.isEmpty(url)){
            Glide.with(imageView)
                    .load(url)
                    .transform(new CircleCrop())
                    .into(imageView);
        }

    }
}
